package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by yanwt on 2017/3/13.
 */
@Getter
@Setter
@Entity
@Table(name = "tb_message_record")
@org.hibernate.annotations.Table(appliesTo = "tb_message_record", comment = "消息发送记录")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="message_record", usage = CacheConcurrencyStrategy.READ_WRITE)
public class MessageRecordEntity  extends DataEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name="message_template_id",columnDefinition=("bigint(20) default null comment '模板消息ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private MessageTemplateEntity messageTemplate;

    @Column(name="send_time",columnDefinition="datetime not null comment '发送时间'")
    private Timestamp sendTime;


}
